package com.gxar.quick.ar.server.base.common.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author nice
 * @version 1.0
 * @created 2023/11/21.
 */
public enum MaterialTypeEnum {

    THREE_D_MODEL(0, "3dModel", "3D模型"),
    TEXT_BOX(1, "textBox", "文本框"),
    VIDEO_BOX(2, "videoBox", "视频框"),
    WORD_ART(3, "wordArt", "艺术字"),
    IMAGE(4, "image", "图片"),
    MUSIC(5, "music", "音频"),
    ;
    private final Integer code;
    private final String name;
    private final String desc;

    MaterialTypeEnum(Integer code, String name, String desc) {
        this.code = code;
        this.name = name;
        this.desc = desc;
    }

    public static MaterialTypeEnum getByCode(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        return Arrays.stream(MaterialTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }
}
